package net.bithappens.hnqe.graph;

import java.net.URI;
import java.util.Date;

import net.bithappens.hnqe.IllegalParamException;


public class GraphValue extends GraphRelationMember {

	private EntryValue entryValue;
	
	public GraphValue(URI uri, EntryValue entryValue) throws IllegalParamException {
		super(uri);
		
		if(entryValue == null){
			throw new IllegalParamException("the value must not be null");
		}
		
		this.entryValue = entryValue;
	}
	
	public GraphValue(URI uri, Date lease, EntryValue entryValue) throws IllegalParamException {
		super(uri, lease);
		
		if(entryValue == null){
			throw new IllegalParamException("the value must not be null");
		}
		
		this.entryValue = entryValue;	
	}
	
	@Override
	public String getTypeId() {
		return entryValue.getValueType();
	}

	public EntryValue getEntryValue() {
		return entryValue;
	}

	public void setValue(EntryValue value) throws IllegalParamException {
		if(value == null){
			throw new IllegalParamException("the value must not be null");
		}
		this.entryValue = value;
	}

	@Override
	public String toString() {
		return "GraphValue [entryValue=" + entryValue + "]";
	}
	
}
